{# Approval cards (#1368): the change queue's confirmation surface, defined
once and shown in the chat (a reply carries the cards its tools proposed)
and in the review list. The rows are the queue's own description of the
change, resolved from the database, never the model's words. Approve and
Reject swap the card for its new state; Edit (a type that lets the reader
put their own words on it first) opens the one dialog, and a saved edit
redraws the card wherever it is up (``refresh``). #}
{% from "components/macros/form.html" import action, checkbox %}
{% from "components/macros/feedback.html" import error_banner %}
{% from "components/macros/layout.html" import avatar, badge, facts %}
{# The frame both cards share: a title line, its right-hand side as the
caller's body, then ``rows``. A batch is a form so its "skip" boxes ride
along: htmx sends the enclosing form's fields with a button's POST. A
decided card (``decided``) folds to that line: history, not homework.
``refresh`` is how a revised card fetches itself again. #}
{% macro _card(tag, id, data, title, side, by=none, decided=False, refresh="") %}
{% set head %}
{{ title }}
{{ side }}
{% endset %}
<{{ tag }} id="{{ id }}" {{ data }} {{ refresh }} class="my-2 border border-aegis-border rounded-lg p-3 text-sm bg-aegis-card">
{% if decided %}{{ head }}
{% else %}
{% if face %}{{ avatar(**face) }}{% endif %}{{ caller() }}
{% endmacro %} {# A card's reading: its subject, the lines that will change, the page it cites or the pictures it files, and its error. #} {% macro _body(row) %} {{ _note(row) }} {% if row.subject %}{% call _subject(row.face) %}{{ row.subject }}{% endcall %}{% endif %}{{ row.note }}
{% endif %}{% endmacro %} {% macro change_card(change) %} {% call _card("div", "change-" ~ change.id, "data-change", change.title, badge(change.label, change.tone), change.by, decided=change.status != "pending", refresh=change.refresh) %} {{ _body(change) }} {% if change.status == "pending" %}{{ _actions(change.url, "data-change", "Reject", change.edit) }}{% endif %} {% endcall %} {% endmacro %} {# One row of a batch: its skip while it waits, its outcome after. #} {% macro _batch_row(row) %}{{ group.span }}
{% endif %}